1. Field of the Invention
The present invention relates to the exchange of data between a computer and a peripheral. In particular, the present invention relates to a method for synchronously writing data to a disk drive.
2. Description Of Related Art
Computer systems including mass storage media such as hard disks are well known. These computer systems include file systems for transferring data to and from the hard disk. A particular limitation in the operational speed of such computers is the input/output (I/O) throughput or the rate at which file systems can read and write data to mass storage devices. File system performance is important because of increased demand on I/O throughput in recent years. Existing file systems such as the UNIX System V file system have severe performance problems for sequential access to files on disk. This presents a particular problem for applications such as VLSI design and image processing applications that process large quantities of data in a small amounts of time, and thus, need to transfer data very quickly between disk and memory.
A particular problem with the prior art file systems is that data is written to the disk drive one block at a time and the blocks have a relatively small size (512-1024 bytes). For example, if the file system has four blocks of data to be transferred to the disk, prior art system would require four separate I/O operations to write the data from memory to the disk drive. This decreases performance because I/O operations are typically very slow in comparison to other operations performed by the central processing unit.
The prior art has attempted to increase the I/O throughput by increasing the block size. An increase in the block size improves throughput because it takes about the same amount of time to transfer a 1 K-byte block of data from memory to disk with a single I/O operation as to transfer a 4 K-byte block of data in a single I/O operation. Thus, rather than requiring four I/O operations to transfer a 3.5 K-byte file to disk, only a single I/O operation is required if the block sized is increased to 4 K-bytes. However, the problem with increasing the block size is that it wastes disk space. Most UNIX file systems include many very small files. For a 4 K-byte block size the wasted disk space can reach 45.6%.
The file systems also include a free list of blocks of the disk. The list identifies those portions of the disk that are available for use. Commonly, the free list is a linked list of pointers to free blocks. Initially, the linked list will identify free block in adjacent areas of the disk space. However, after use the free list deteriorates from its original form where adjacent blocks are listed sequentially into a random list of block positions. This deterioration decreases the I/O throughput since the seek time for the disk between each block access increased because the list does not identify sequential blocks on the disk. Attempts to increase system file performance have included schemes to store the data sequentially on the disk. However, these schemes have not been completely successful in increasing file system performance.
Prior art systems such as UNIX 4.2 Berkeley Software Distribution (BSD) and the Counterpoint Fast File System attempt to improve system I/O throughput. Both systems use a bit map of free blocks instead of a linked list of free blocks. Additionally, large data block I/O operations are provided to increase throughput. For example, the BSD allows transfers from disk to memory in blocks of up to 8 K-bytes and fragments of 1-7 K-bytes for reads and delayed writes. The Counterpoint Fast File System implements a fast file system algorithm in which free disk blocks are bit mapped. Reads and delayed writes are handled in clusters (up to 32 K bytes in one disk I/O). However, the use of the bit map and transfer of contiguous blocks of data to the disk drive was limited to delayed writes and reads. Synchronous writes, writes in which the file system waits for the write operation to be completed before proceeding with other operations, were not improved in the prior art file systems. Measurement of Network File System (NFS) server performance on systems implementing the Counterpoint Fast File System reveals that the network file system server continues to write very slowly to the disk (in the neighborhood of 30 K bytes/sec). The slowness in writing to disk is largely due to the inefficiency of the local file system in handling synchronous writes. The handling of synchronous writes is left the same as that of the original UNIX System V. Therefore, there is a need for an improved method for writing synchronously to mass storage devices.